package com.harboursoftware.xstorage.db;

import com.harboursoftware.xstorage.db.sql.BucketSqlDao;
import com.harboursoftware.xstorage.db.sql.DatabaseProvider;
import com.harboursoftware.xstorage.db.sql.DatabaseProviderImpl;
import com.harboursoftware.xstorage.db.sql.UserSqlDao;

/**
 * Dao（数据访问层）的统一入口。
 * 
 * @author Simon Leung
 * @since 0.1
 */
public class DaoManager {
    private static  DaoManager instance = new DaoManager();
    
    private DatabaseProvider databaseProvider = DatabaseProviderImpl.getInstance();
    private UserDao userDao = new UserSqlDao(databaseProvider);
    private BucketDao bucketDao = new BucketSqlDao(databaseProvider);
    
    /**
     * singleton
     */
    private DaoManager() {}
    
    public static DaoManager getInstance() {
        return instance;
    }

    public BucketDao getBucketDao() {
        return bucketDao;
    }
    
    public UserDao getUserDao() {
        return userDao; 
    }
}
